{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "arcface-tf2.ipynb",
      "provenance": [],
      "collapsed_sections": [],
      "toc_visible": true
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "accelerator": "GPU"
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "9YvVZuXTbx9j",
        "colab_type": "text"
      },
      "source": [
        "# Demo arcface-tf2 encode on single image input\n",
        "This notebooks shows the testing results of the ArcFace model trained on Tensorflow2.0+."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "emiMjP6rcO6R",
        "colab_type": "text"
      },
      "source": [
        "## Setup Environment\n",
        "\n"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "pwCjbXk6bwz5",
        "colab_type": "code",
        "outputId": "fcc00b19-864e-49fa-c860-45323b014f93",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        }
      },
      "source": [
        "!git clone https://github.com/peteryuX/arcface-tf2.git\n",
        "%cd arcface-tf2/\n",
        "!pip install -r requirements.txt"
      ],
      "execution_count": 17,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Cloning into 'arcface-tf2'...\n",
            "remote: Enumerating objects: 70, done.\u001b[K\n",
            "remote: Counting objects:   1% (1/70)\u001b[K\rremote: Counting objects:   2% (2/70)\u001b[K\rremote: Counting objects:   4% (3/70)\u001b[K\rremote: Counting objects:   5% (4/70)\u001b[K\rremote: Counting objects:   7% (5/70)\u001b[K\rremote: Counting objects:   8% (6/70)\u001b[K\rremote: Counting objects:  10% (7/70)\u001b[K\rremote: Counting objects:  11% (8/70)\u001b[K\rremote: Counting objects:  12% (9/70)\u001b[K\rremote: Counting objects:  14% (10/70)\u001b[K\rremote: Counting objects:  15% (11/70)\u001b[K\rremote: Counting objects:  17% (12/70)\u001b[K\rremote: Counting objects:  18% (13/70)\u001b[K\rremote: Counting objects:  20% (14/70)\u001b[K\rremote: Counting objects:  21% (15/70)\u001b[K\rremote: Counting objects:  22% (16/70)\u001b[K\rremote: Counting objects:  24% (17/70)\u001b[K\rremote: Counting objects:  25% (18/70)\u001b[K\rremote: Counting objects:  27% (19/70)\u001b[K\rremote: Counting objects:  28% (20/70)\u001b[K\rremote: Counting objects:  30% (21/70)\u001b[K\rremote: Counting objects:  31% (22/70)\u001b[K\rremote: Counting objects:  32% (23/70)\u001b[K\rremote: Counting objects:  34% (24/70)\u001b[K\rremote: Counting objects:  35% (25/70)\u001b[K\rremote: Counting objects:  37% (26/70)\u001b[K\rremote: Counting objects:  38% (27/70)\u001b[K\rremote: Counting objects:  40% (28/70)\u001b[K\rremote: Counting objects:  41% (29/70)\u001b[K\rremote: Counting objects:  42% (30/70)\u001b[K\rremote: Counting objects:  44% (31/70)\u001b[K\rremote: Counting objects:  45% (32/70)\u001b[K\rremote: Counting objects:  47% (33/70)\u001b[K\rremote: Counting objects:  48% (34/70)\u001b[K\rremote: Counting objects:  50% (35/70)\u001b[K\rremote: Counting objects:  51% (36/70)\u001b[K\rremote: Counting objects:  52% (37/70)\u001b[K\rremote: Counting objects:  54% (38/70)\u001b[K\rremote: Counting objects:  55% (39/70)\u001b[K\rremote: Counting objects:  57% (40/70)\u001b[K\rremote: Counting objects:  58% (41/70)\u001b[K\rremote: Counting objects:  60% (42/70)\u001b[K\rremote: Counting objects:  61% (43/70)\u001b[K\rremote: Counting objects:  62% (44/70)\u001b[K\rremote: Counting objects:  64% (45/70)\u001b[K\rremote: Counting objects:  65% (46/70)\u001b[K\rremote: Counting objects:  67% (47/70)\u001b[K\rremote: Counting objects:  68% (48/70)\u001b[K\rremote: Counting objects:  70% (49/70)\u001b[K\rremote: Counting objects:  71% (50/70)\u001b[K\rremote: Counting objects:  72% (51/70)\u001b[K\rremote: Counting objects:  74% (52/70)\u001b[K\rremote: Counting objects:  75% (53/70)\u001b[K\rremote: Counting objects:  77% (54/70)\u001b[K\rremote: Counting objects:  78% (55/70)\u001b[K\rremote: Counting objects:  80% (56/70)\u001b[K\rremote: Counting objects:  81% (57/70)\u001b[K\rremote: Counting objects:  82% (58/70)\u001b[K\rremote: Counting objects:  84% (59/70)\u001b[K\rremote: Counting objects:  85% (60/70)\u001b[K\rremote: Counting objects:  87% (61/70)\u001b[K\rremote: Counting objects:  88% (62/70)\u001b[K\rremote: Counting objects:  90% (63/70)\u001b[K\rremote: Counting objects:  91% (64/70)\u001b[K\rremote: Counting objects:  92% (65/70)\u001b[K\rremote: Counting objects:  94% (66/70)\u001b[K\rremote: Counting objects:  95% (67/70)\u001b[K\rremote: Counting objects:  97% (68/70)\u001b[K\rremote: Counting objects:  98% (69/70)\u001b[K\rremote: Counting objects: 100% (70/70)\u001b[K\rremote: Counting objects: 100% (70/70), done.\u001b[K\n",
            "remote: Compressing objects:   1% (1/52)\u001b[K\rremote: Compressing objects:   3% (2/52)\u001b[K\rremote: Compressing objects:   5% (3/52)\u001b[K\rremote: Compressing objects:   7% (4/52)\u001b[K\rremote: Compressing objects:   9% (5/52)\u001b[K\rremote: Compressing objects:  11% (6/52)\u001b[K\rremote: Compressing objects:  13% (7/52)\u001b[K\rremote: Compressing objects:  15% (8/52)\u001b[K\rremote: Compressing objects:  17% (9/52)\u001b[K\rremote: Compressing objects:  19% (10/52)\u001b[K\rremote: Compressing objects:  21% (11/52)\u001b[K\rremote: Compressing objects:  23% (12/52)\u001b[K\rremote: Compressing objects:  25% (13/52)\u001b[K\rremote: Compressing objects:  26% (14/52)\u001b[K\rremote: Compressing objects:  28% (15/52)\u001b[K\rremote: Compressing objects:  30% (16/52)\u001b[K\rremote: Compressing objects:  32% (17/52)\u001b[K\rremote: Compressing objects:  34% (18/52)\u001b[K\rremote: Compressing objects:  36% (19/52)\u001b[K\rremote: Compressing objects:  38% (20/52)\u001b[K\rremote: Compressing objects:  40% (21/52)\u001b[K\rremote: Compressing objects:  42% (22/52)\u001b[K\rremote: Compressing objects:  44% (23/52)\u001b[K\rremote: Compressing objects:  46% (24/52)\u001b[K\rremote: Compressing objects:  48% (25/52)\u001b[K\rremote: Compressing objects:  50% (26/52)\u001b[K\rremote: Compressing objects:  51% (27/52)\u001b[K\rremote: Compressing objects:  53% (28/52)\u001b[K\rremote: Compressing objects:  55% (29/52)\u001b[K\rremote: Compressing objects:  57% (30/52)\u001b[K\rremote: Compressing objects:  59% (31/52)\u001b[K\rremote: Compressing objects:  61% (32/52)\u001b[K\rremote: Compressing objects:  63% (33/52)\u001b[K\rremote: Compressing objects:  65% (34/52)\u001b[K\rremote: Compressing objects:  67% (35/52)\u001b[K\rremote: Compressing objects:  69% (36/52)\u001b[K\rremote: Compressing objects:  71% (37/52)\u001b[K\rremote: Compressing objects:  73% (38/52)\u001b[K\rremote: Compressing objects:  75% (39/52)\u001b[K\rremote: Compressing objects:  76% (40/52)\u001b[K\rremote: Compressing objects:  78% (41/52)\u001b[K\rremote: Compressing objects:  80% (42/52)\u001b[K\rremote: Compressing objects:  82% (43/52)\u001b[K\rremote: Compressing objects:  84% (44/52)\u001b[K\rremote: Compressing objects:  86% (45/52)\u001b[K\rremote: Compressing objects:  88% (46/52)\u001b[K\rremote: Compressing objects:  90% (47/52)\u001b[K\rremote: Compressing objects:  92% (48/52)\u001b[K\rremote: Compressing objects:  94% (49/52)\u001b[K\rremote: Compressing objects:  96% (50/52)\u001b[K\rremote: Compressing objects:  98% (51/52)\u001b[K\rremote: Compressing objects: 100% (52/52)\u001b[K\rremote: Compressing objects: 100% (52/52), done.\u001b[K\n",
            "Receiving objects:   1% (1/100)   \rReceiving objects:   2% (2/100)   \rReceiving objects:   3% (3/100)   \rReceiving objects:   4% (4/100)   \rReceiving objects:   5% (5/100)   \rReceiving objects:   6% (6/100)   \rReceiving objects:   7% (7/100)   \rReceiving objects:   8% (8/100)   \rReceiving objects:   9% (9/100)   \rReceiving objects:  10% (10/100)   \rReceiving objects:  11% (11/100)   \rReceiving objects:  12% (12/100)   \rReceiving objects:  13% (13/100)   \rReceiving objects:  14% (14/100)   \rReceiving objects:  15% (15/100)   \rReceiving objects:  16% (16/100)   \rReceiving objects:  17% (17/100)   \rReceiving objects:  18% (18/100)   \rReceiving objects:  19% (19/100)   \rReceiving objects:  20% (20/100)   \rReceiving objects:  21% (21/100)   \rReceiving objects:  22% (22/100)   \rReceiving objects:  23% (23/100)   \rReceiving objects:  24% (24/100)   \rReceiving objects:  25% (25/100)   \rReceiving objects:  26% (26/100)   \rReceiving objects:  27% (27/100)   \rReceiving objects:  28% (28/100)   \rReceiving objects:  29% (29/100)   \rReceiving objects:  30% (30/100)   \rReceiving objects:  31% (31/100)   \rremote: Total 100 (delta 42), reused 37 (delta 18), pack-reused 30\u001b[K\n",
            "Receiving objects:  32% (32/100)   \rReceiving objects:  33% (33/100)   \rReceiving objects:  34% (34/100)   \rReceiving objects:  35% (35/100)   \rReceiving objects:  36% (36/100)   \rReceiving objects:  37% (37/100)   \rReceiving objects:  38% (38/100)   \rReceiving objects:  39% (39/100)   \rReceiving objects:  40% (40/100)   \rReceiving objects:  41% (41/100)   \rReceiving objects:  42% (42/100)   \rReceiving objects:  43% (43/100)   \rReceiving objects:  44% (44/100)   \rReceiving objects:  45% (45/100)   \rReceiving objects:  46% (46/100)   \rReceiving objects:  47% (47/100)   \rReceiving objects:  48% (48/100)   \rReceiving objects:  49% (49/100)   \rReceiving objects:  50% (50/100)   \rReceiving objects:  51% (51/100)   \rReceiving objects:  52% (52/100)   \rReceiving objects:  53% (53/100)   \rReceiving objects:  54% (54/100)   \rReceiving objects:  55% (55/100)   \rReceiving objects:  56% (56/100)   \rReceiving objects:  57% (57/100)   \rReceiving objects:  58% (58/100)   \rReceiving objects:  59% (59/100)   \rReceiving objects:  60% (60/100)   \rReceiving objects:  61% (61/100)   \rReceiving objects:  62% (62/100)   \rReceiving objects:  63% (63/100)   \rReceiving objects:  64% (64/100)   \rReceiving objects:  65% (65/100)   \rReceiving objects:  66% (66/100)   \rReceiving objects:  67% (67/100)   \rReceiving objects:  68% (68/100)   \rReceiving objects:  69% (69/100)   \rReceiving objects:  70% (70/100)   \rReceiving objects:  71% (71/100)   \rReceiving objects:  72% (72/100)   \rReceiving objects:  73% (73/100)   \rReceiving objects:  74% (74/100)   \rReceiving objects:  75% (75/100)   \rReceiving objects:  76% (76/100)   \rReceiving objects:  77% (77/100)   \rReceiving objects:  78% (78/100)   \rReceiving objects:  79% (79/100)   \rReceiving objects:  80% (80/100)   \rReceiving objects:  81% (81/100)   \rReceiving objects:  82% (82/100)   \rReceiving objects:  83% (83/100)   \rReceiving objects:  84% (84/100)   \rReceiving objects:  85% (85/100)   \rReceiving objects:  86% (86/100)   \rReceiving objects:  87% (87/100)   \rReceiving objects:  88% (88/100)   \rReceiving objects:  89% (89/100)   \rReceiving objects:  90% (90/100)   \rReceiving objects:  91% (91/100)   \rReceiving objects:  92% (92/100)   \rReceiving objects:  93% (93/100)   \rReceiving objects:  94% (94/100)   \rReceiving objects:  95% (95/100)   \rReceiving objects:  96% (96/100)   \rReceiving objects:  97% (97/100)   \rReceiving objects:  98% (98/100)   \rReceiving objects:  99% (99/100)   \rReceiving objects: 100% (100/100)   \rReceiving objects: 100% (100/100), 99.03 KiB | 7.62 MiB/s, done.\n",
            "Resolving deltas:   0% (0/47)   \rResolving deltas:   2% (1/47)   \rResolving deltas:   8% (4/47)   \rResolving deltas:  12% (6/47)   \rResolving deltas:  42% (20/47)   \rResolving deltas:  59% (28/47)   \rResolving deltas:  70% (33/47)   \rResolving deltas:  76% (36/47)   \rResolving deltas:  82% (39/47)   \rResolving deltas:  91% (43/47)   \rResolving deltas: 100% (47/47)   \rResolving deltas: 100% (47/47), done.\n",
            "/content/arcface-tf2/arcface-tf2/arcface-tf2/arcface-tf2/arcface-tf2\n",
            "Requirement already satisfied: tensorflow-gpu==2.1.0 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 1)) (2.1.0)\n",
            "Requirement already satisfied: opencv-python==4.1.1.26 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 2)) (4.1.1.26)\n",
            "Requirement already satisfied: bcolz==1.2.1 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 3)) (1.2.1)\n",
            "Requirement already satisfied: sklearn2 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 4)) (0.0.13)\n",
            "Requirement already satisfied: PyYAML in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 5)) (3.13)\n",
            "Requirement already satisfied: tqdm in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 6)) (4.28.1)\n",
            "Requirement already satisfied: gast==0.2.2 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (0.2.2)\n",
            "Requirement already satisfied: opt-einsum>=2.3.2 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (3.1.0)\n",
            "Requirement already satisfied: six>=1.12.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (1.12.0)\n",
            "Requirement already satisfied: absl-py>=0.7.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (0.9.0)\n",
            "Requirement already satisfied: tensorboard<2.2.0,>=2.1.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (2.1.0)\n",
            "Requirement already satisfied: protobuf>=3.8.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (3.10.0)\n",
            "Requirement already satisfied: google-pasta>=0.1.6 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (0.1.8)\n",
            "Requirement already satisfied: grpcio>=1.8.6 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (1.27.1)\n",
            "Requirement already satisfied: termcolor>=1.1.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (1.1.0)\n",
            "Requirement already satisfied: wrapt>=1.11.1 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (1.11.2)\n",
            "Requirement already satisfied: keras-preprocessing>=1.1.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (1.1.0)\n",
            "Requirement already satisfied: astor>=0.6.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (0.8.1)\n",
            "Requirement already satisfied: keras-applications>=1.0.8 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (1.0.8)\n",
            "Requirement already satisfied: scipy==1.4.1; python_version >= \"3\" in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (1.4.1)\n",
            "Requirement already satisfied: wheel>=0.26; python_version >= \"3\" in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (0.34.2)\n",
            "Requirement already satisfied: numpy<2.0,>=1.16.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (1.17.5)\n",
            "Requirement already satisfied: tensorflow-estimator<2.2.0,>=2.1.0rc0 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (2.1.0)\n",
            "Requirement already satisfied: pandas>=0.17.1 in /usr/local/lib/python3.6/dist-packages (from sklearn2->-r requirements.txt (line 4)) (0.25.3)\n",
            "Requirement already satisfied: matplotlib>=1.5.1 in /usr/local/lib/python3.6/dist-packages (from sklearn2->-r requirements.txt (line 4)) (3.1.3)\n",
            "Requirement already satisfied: statsmodels in /usr/local/lib/python3.6/dist-packages (from sklearn2->-r requirements.txt (line 4)) (0.10.2)\n",
            "Requirement already satisfied: patsy in /usr/local/lib/python3.6/dist-packages (from sklearn2->-r requirements.txt (line 4)) (0.5.1)\n",
            "Requirement already satisfied: scikit-learn>=0.18 in /usr/local/lib/python3.6/dist-packages (from sklearn2->-r requirements.txt (line 4)) (0.22.1)\n",
            "Requirement already satisfied: pydot in /usr/local/lib/python3.6/dist-packages (from sklearn2->-r requirements.txt (line 4)) (1.3.0)\n",
            "Requirement already satisfied: pytest in /usr/local/lib/python3.6/dist-packages (from sklearn2->-r requirements.txt (line 4)) (3.6.4)\n",
            "Requirement already satisfied: category-encoders in /usr/local/lib/python3.6/dist-packages (from sklearn2->-r requirements.txt (line 4)) (2.1.0)\n",
            "Requirement already satisfied: requests<3,>=2.21.0 in /usr/local/lib/python3.6/dist-packages (from tensorboard<2.2.0,>=2.1.0->tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (2.21.0)\n",
            "Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in /usr/local/lib/python3.6/dist-packages (from tensorboard<2.2.0,>=2.1.0->tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (0.4.1)\n",
            "Requirement already satisfied: markdown>=2.6.8 in /usr/local/lib/python3.6/dist-packages (from tensorboard<2.2.0,>=2.1.0->tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (3.2.1)\n",
            "Requirement already satisfied: setuptools>=41.0.0 in /usr/local/lib/python3.6/dist-packages (from tensorboard<2.2.0,>=2.1.0->tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (45.1.0)\n",
            "Requirement already satisfied: werkzeug>=0.11.15 in /usr/local/lib/python3.6/dist-packages (from tensorboard<2.2.0,>=2.1.0->tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (1.0.0)\n",
            "Requirement already satisfied: google-auth<2,>=1.6.3 in /usr/local/lib/python3.6/dist-packages (from tensorboard<2.2.0,>=2.1.0->tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (1.7.2)\n",
            "Requirement already satisfied: h5py in /usr/local/lib/python3.6/dist-packages (from keras-applications>=1.0.8->tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (2.8.0)\n",
            "Requirement already satisfied: pytz>=2017.2 in /usr/local/lib/python3.6/dist-packages (from pandas>=0.17.1->sklearn2->-r requirements.txt (line 4)) (2018.9)\n",
            "Requirement already satisfied: python-dateutil>=2.6.1 in /usr/local/lib/python3.6/dist-packages (from pandas>=0.17.1->sklearn2->-r requirements.txt (line 4)) (2.6.1)\n",
            "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib>=1.5.1->sklearn2->-r requirements.txt (line 4)) (1.1.0)\n",
            "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.6/dist-packages (from matplotlib>=1.5.1->sklearn2->-r requirements.txt (line 4)) (0.10.0)\n",
            "Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib>=1.5.1->sklearn2->-r requirements.txt (line 4)) (2.4.6)\n",
            "Requirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.6/dist-packages (from scikit-learn>=0.18->sklearn2->-r requirements.txt (line 4)) (0.14.1)\n",
            "Requirement already satisfied: py>=1.5.0 in /usr/local/lib/python3.6/dist-packages (from pytest->sklearn2->-r requirements.txt (line 4)) (1.8.1)\n",
            "Requirement already satisfied: more-itertools>=4.0.0 in /usr/local/lib/python3.6/dist-packages (from pytest->sklearn2->-r requirements.txt (line 4)) (8.2.0)\n",
            "Requirement already satisfied: attrs>=17.4.0 in /usr/local/lib/python3.6/dist-packages (from pytest->sklearn2->-r requirements.txt (line 4)) (19.3.0)\n",
            "Requirement already satisfied: atomicwrites>=1.0 in /usr/local/lib/python3.6/dist-packages (from pytest->sklearn2->-r requirements.txt (line 4)) (1.3.0)\n",
            "Requirement already satisfied: pluggy<0.8,>=0.5 in /usr/local/lib/python3.6/dist-packages (from pytest->sklearn2->-r requirements.txt (line 4)) (0.7.1)\n",
            "Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.6/dist-packages (from requests<3,>=2.21.0->tensorboard<2.2.0,>=2.1.0->tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (3.0.4)\n",
            "Requirement already satisfied: urllib3<1.25,>=1.21.1 in /usr/local/lib/python3.6/dist-packages (from requests<3,>=2.21.0->tensorboard<2.2.0,>=2.1.0->tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (1.24.3)\n",
            "Requirement already satisfied: idna<2.9,>=2.5 in /usr/local/lib/python3.6/dist-packages (from requests<3,>=2.21.0->tensorboard<2.2.0,>=2.1.0->tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (2.8)\n",
            "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/dist-packages (from requests<3,>=2.21.0->tensorboard<2.2.0,>=2.1.0->tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (2019.11.28)\n",
            "Requirement already satisfied: requests-oauthlib>=0.7.0 in /usr/local/lib/python3.6/dist-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.2.0,>=2.1.0->tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (1.3.0)\n",
            "Requirement already satisfied: cachetools<3.2,>=2.0.0 in /usr/local/lib/python3.6/dist-packages (from google-auth<2,>=1.6.3->tensorboard<2.2.0,>=2.1.0->tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (3.1.1)\n",
            "Requirement already satisfied: rsa<4.1,>=3.1.4 in /usr/local/lib/python3.6/dist-packages (from google-auth<2,>=1.6.3->tensorboard<2.2.0,>=2.1.0->tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (4.0)\n",
            "Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.6/dist-packages (from google-auth<2,>=1.6.3->tensorboard<2.2.0,>=2.1.0->tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (0.2.8)\n",
            "Requirement already satisfied: oauthlib>=3.0.0 in /usr/local/lib/python3.6/dist-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.2.0,>=2.1.0->tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (3.1.0)\n",
            "Requirement already satisfied: pyasn1>=0.1.3 in /usr/local/lib/python3.6/dist-packages (from rsa<4.1,>=3.1.4->google-auth<2,>=1.6.3->tensorboard<2.2.0,>=2.1.0->tensorflow-gpu==2.1.0->-r requirements.txt (line 1)) (0.4.8)\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "Wh0RUrq2hPsp",
        "colab_type": "text"
      },
      "source": [
        "## Dowload Pretrained Model"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "eXcLo3eiftON",
        "colab_type": "code",
        "outputId": "97a6b373-c4a0-40fe-c897-9246ddf01343",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 53
        }
      },
      "source": [
        "from google_drive_downloader import GoogleDriveDownloader as gdd\n",
        "\n",
        "gdd.download_file_from_google_drive(file_id='1HasWQb86s4xSYy36YbmhRELg9LBmvhvt',\n",
        "                                    dest_path='./arc_res50.zip',\n",
        "                                    unzip=True)\n",
        "!mkdir checkpoints\n",
        "!mv arc_res50 checkpoints/arc_res50\n",
        "!rm arc_res50.zip"
      ],
      "execution_count": 18,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Downloading 1HasWQb86s4xSYy36YbmhRELg9LBmvhvt into ./arc_res50.zip... Done.\n",
            "Unzipping...Done.\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "MV64le7MjVPt",
        "colab_type": "text"
      },
      "source": [
        "## The Source Image"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "UIFIa3qlugsa",
        "colab_type": "code",
        "outputId": "25f7b1c8-41c7-4703-f5bb-25b934b0583f",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 267
        }
      },
      "source": [
        "from IPython.display import Image\n",
        "Image(filename='./data/BruceLee.jpg')"
      ],
      "execution_count": 19,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a\nHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy\nMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAD6APoDASIA\nAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA\nAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3\nODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWm\np6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEA\nAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSEx\nBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElK\nU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3\nuLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDiP7SY\nH7xppv3+Y57Vnbh9aMjHGaw5UbFp7onnNMS4IbNV+COtJnFPlCyNeHUCgIzirK6t/tVz+evNIWOO\ntTyjtY6b+1/kbLcketc7qeqNckoABgdqgkmYIUViOKybiXd8q59D71cIamUtxhkKnIOW7H0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3qIGms3r1osMbIam024+zahDJ/tYNRw2813KsUK\nF3J4Ar0Lw74KhskW81MBn6iP0+tNtJWNKabehSvokuItpAPHDVzlxBLC3XK+tdZq0axXLqoxG3K+\n1c7cOclCOlSd07dTPCk9TT1AGDinEY7UzByOlBmTAimqDI+0dDSFsLUlscEtQO5dXCBVUVIGPH86\niBGKdnFBoiYscZNIW4GKiZugzxQGyRzwKY7jn+Y0rRkLnHFInLc1ak2hQBz3qSTNdc59aiU59sVa\nfgkYqBl9vwpXMyRH6VMpBH41TUlT71Oj8EUylIv21/LbP944FbI1rIHP61ziAyMFAyTxXTR+GnaJ\nG2nlQelMtannMqZcEUhXbVh/vU1xQmeUVDx1oALUr9aEqxi44ppqQ/dFNPQ0rgNU1Kh5xUQ605O9\nDAkJ5/SmHrSk/wAqb60kAZq1pul3Oq3SwwKSCeT6VUP3a9F8HIq6fuVQGPcDmhs0hHmdjZ0TQbPQ\n7cEIHuMcuaffSyz+uKuknC89qmUDyn4HSpR6EIqK0OQvAZ4zGF+dehNczdJknjDjqK7e5VRfNgAf\nhXK6wAL2TAqpIqotLmK3pSY4qRwN54pF70jAiZT0qxGAqioT1qUfcNIFuSrIBzxSs+QcdagXrQD8\np+lBVybzOOtSBuKrHvUi9KATJRJtY461YSYONtUWqSLoaB31LMq55FV2/Kri/wBKrSfeNAmQlOc0\ngO3tUpqM0iDQ0gCTUI8+teoR2p8tf3uOBXlmiE/b0rv1d9o+dunrTaubQV0f/9k=\n",
            "text/plain": [
              "<IPython.core.display.Image object>"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 19
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "VzLqJ0Jtu1yD",
        "colab_type": "text"
      },
      "source": [
        "## Encoding Result from Testing Script"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "d2_s_KAjt82c",
        "colab_type": "code",
        "outputId": "3ebe3a54-b708-440d-e755-b5167af58d2d",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        }
      },
      "source": [
        "import numpy as np\n",
        "!python test.py --cfg_path=\"./configs/arc_res50.yaml\" --img_path=\"./data/BruceLee.jpg\"\n",
        "encoded = np.load('./output_embeds.npy')\n",
        "print(encoded.shape)\n",
        "print(encoded)"
      ],
      "execution_count": 22,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "2020-02-19 15:25:46.098223: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer.so.6'; dlerror: libnvinfer.so.6: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/lib64-nvidia\n",
            "2020-02-19 15:25:46.098328: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer_plugin.so.6'; dlerror: libnvinfer_plugin.so.6: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/lib64-nvidia\n",
            "2020-02-19 15:25:46.098345: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:30] Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.\n",
            "I0219 15:25:47.319335 140070095341440 utils.py:19] Detect 1 Physical GPUs, 1 Logical GPUs.\n",
            "[*] load ckpt from ./checkpoints/arc_res50/e_8_b_40000.ckpt\n",
            "[*] Encode ./data/BruceLee.jpg to ./output_embeds.npy\n",
            "(1, 512)\n",
            "[[-4.80905138e-02 -1.23190254e-01  2.45417617e-02  5.27928472e-02\n",
            "  -4.74329479e-02 -1.22240968e-02 -2.91120820e-02 -5.42931110e-02\n",
            "   3.75397946e-03  2.67332960e-02 -5.30030318e-02  1.44368950e-02\n",
            "   4.97956723e-02  3.06899630e-04  3.04740015e-02 -2.45739352e-02\n",
            "  -4.55519604e-03 -4.08356749e-02 -5.62473685e-02  2.31215172e-02\n",
            "  -1.32656600e-02 -1.20939836e-02  1.03728659e-02 -8.13544728e-03\n",
            "  -7.79991746e-02 -9.77786034e-02 -2.59018261e-02  1.49445441e-02\n",
            "  -2.52409391e-02 -7.19650388e-02  7.67542794e-02  8.47768784e-02\n",
            "  -3.17261629e-02 -9.09139290e-02 -1.62879080e-02  1.86013728e-02\n",
            "   5.35098556e-03  1.99791254e-03 -1.77381262e-02 -4.11040261e-02\n",
            "  -2.65099257e-02  4.97119687e-02 -2.51307823e-02 -3.40234488e-02\n",
            "  -2.25072876e-02 -2.21751481e-02  1.13863622e-04 -1.21041331e-02\n",
            "  -4.14608121e-02 -1.63239725e-02 -3.88413258e-02 -6.52482435e-02\n",
            "  -1.50995636e-02  4.13995376e-03  2.11701002e-02  1.10095710e-01\n",
            "  -3.37189399e-02  2.65612695e-02  1.89530440e-02 -5.57352975e-02\n",
            "   9.33501404e-03 -1.08592091e-02  5.99450804e-02 -3.33518460e-02\n",
            "  -1.13645671e-02 -5.64487949e-02 -9.70632583e-02  1.24760149e-02\n",
            "   4.36080284e-02  1.91986766e-02 -1.69068463e-02 -6.26249379e-03\n",
            "  -1.50778145e-02 -9.67543498e-02 -1.54572688e-02 -6.01504482e-02\n",
            "  -2.58132257e-03  4.46549803e-03 -1.11170523e-01 -4.01753150e-02\n",
            "  -9.08432342e-03 -3.06640705e-03 -2.40849685e-02  3.70876268e-02\n",
            "   5.35748317e-04 -3.04241534e-02  2.35491265e-02 -3.95635739e-02\n",
            "  -6.79065809e-02 -2.88516865e-03 -2.74932832e-02  1.67604648e-02\n",
            "  -8.05781968e-03 -3.95853668e-02  1.40653374e-02 -1.03120012e-02\n",
            "   2.34529432e-02  4.94859852e-02 -6.80108666e-02 -2.67652106e-02\n",
            "   2.60797143e-02 -2.10098475e-02 -1.22900024e-01 -5.85591272e-02\n",
            "   8.15035701e-02 -1.46890692e-02  3.57946195e-02  1.86831376e-03\n",
            "   2.22799592e-02  3.82444970e-02  1.16903530e-02  3.98963168e-02\n",
            "  -1.10002413e-01 -2.14022454e-02  3.40237804e-02 -2.43472531e-02\n",
            "  -2.03574263e-02 -1.11344794e-03 -6.85842186e-02 -3.54071632e-02\n",
            "   4.04261425e-02  1.74520016e-02 -2.43065450e-02  1.29965078e-02\n",
            "   4.87859324e-02  2.67125312e-02 -2.52205338e-02 -4.78234068e-02\n",
            "   1.93747692e-02 -4.37203869e-02 -1.54647129e-02 -2.02635825e-02\n",
            "  -2.56318562e-02 -1.85766537e-03 -1.94739327e-02  4.09651995e-02\n",
            "  -3.62631977e-02 -3.99901867e-02 -2.25847587e-02 -1.00525124e-02\n",
            "  -7.92388096e-02 -6.53828159e-02  2.02839952e-02 -7.60802627e-02\n",
            "  -1.83536224e-02  3.80226411e-02  7.11188838e-02  5.42634213e-03\n",
            "   5.23682730e-03  2.89062839e-02  7.24428985e-03  7.47902170e-02\n",
            "   3.08666546e-02 -5.45888580e-02  1.35026276e-01  3.37444209e-02\n",
            "  -4.04978804e-02  1.54583193e-02 -2.77281459e-02 -1.46584837e-02\n",
            "  -3.97973228e-03 -1.85963213e-02  3.50466222e-02 -4.00066040e-02\n",
            "  -2.85307597e-02  5.22171259e-02  5.70704404e-04 -6.08035643e-03\n",
            "   5.16114309e-02 -1.67577881e-02 -3.50118242e-02 -2.37654876e-02\n",
            "  -1.83372591e-02  5.44292554e-02 -8.73742625e-02  5.97241707e-02\n",
            "  -1.84030142e-02  3.11591700e-02 -3.52365673e-02  9.27214101e-02\n",
            "   2.50722375e-02  2.62532290e-02  1.78059435e-03 -2.38215271e-02\n",
            "  -3.43927108e-02 -6.76934570e-02 -2.23534014e-02 -6.08204491e-02\n",
            "  -9.45161004e-03 -1.02617545e-02  2.53869165e-02 -5.58646619e-02\n",
            "   1.12221728e-03  4.24917340e-02  1.81192774e-02 -6.99886680e-02\n",
            "   3.31096724e-02  2.48225406e-02  4.43908349e-02  5.10489196e-02\n",
            "  -1.06417639e-02 -3.98515351e-02  3.18127610e-02 -2.64871251e-02\n",
            "  -2.89897155e-02  2.42580827e-02 -8.34581535e-03  5.24358265e-03\n",
            "   3.90848964e-02 -4.83288653e-02 -2.09719408e-02  7.59581625e-02\n",
            "  -8.79625231e-02 -7.51363754e-04 -3.19746113e-03  1.76802147e-02\n",
            "   4.13315892e-02 -3.79090682e-02  1.27013996e-01 -2.84782294e-02\n",
            "   6.79234639e-02  2.27599107e-02 -1.05055831e-01  4.93621938e-02\n",
            "   8.54837298e-02  1.60867944e-02  8.17023963e-03 -2.19328166e-03\n",
            "  -9.64434817e-03  2.47695502e-02 -4.83925603e-02 -1.11858621e-02\n",
            "  -3.11695086e-03  4.51747179e-02  3.04738954e-02  1.17683537e-01\n",
            "   7.67854452e-02 -1.33703556e-02 -8.35734829e-02 -2.84770727e-02\n",
            "  -4.68859002e-02  3.39551130e-03  1.18914479e-02  4.44456898e-02\n",
            "   6.99771419e-02  1.70470420e-02  3.92320454e-02  3.25800888e-02\n",
            "   9.22465231e-03  2.37926678e-03  5.18393470e-03  1.67510647e-04\n",
            "   2.74892617e-02  7.16258888e-04  1.78015251e-02  1.25804106e-02\n",
            "  -4.79573235e-02 -2.46426556e-03 -2.45062467e-02 -1.22330093e-03\n",
            "  -4.51194420e-02  4.45099510e-02  1.75765455e-02 -1.66806635e-02\n",
            "   7.10333930e-03 -7.46262521e-02  8.50887690e-03  3.43516981e-03\n",
            "  -3.61839049e-02 -2.49525327e-02 -3.82143036e-02  2.18171179e-02\n",
            "   5.41856466e-03 -2.65479796e-02  1.31294811e-02 -2.45155580e-02\n",
            "  -6.36739060e-02 -1.92803144e-03 -6.04677899e-03 -3.14777941e-02\n",
            "   5.26253060e-02 -4.55781408e-02  5.69202797e-03 -6.41246438e-02\n",
            "  -1.35056553e-02  7.83053711e-02 -2.38262769e-02 -1.94268711e-02\n",
            "  -7.60495886e-02 -7.28804152e-03 -2.22640056e-02 -6.35861084e-02\n",
            "   5.13347089e-02  8.21247473e-02  1.87035594e-02 -4.37015891e-02\n",
            "   7.94105157e-02  3.69357839e-02 -3.37348469e-02 -9.65530344e-04\n",
            "   7.16940314e-02 -3.87544408e-02 -9.31184087e-03  1.86224550e-03\n",
            "  -8.96440744e-02 -7.20996931e-02 -9.19042970e-04  1.21864546e-02\n",
            "  -1.00832479e-02  2.94876955e-02  2.45778076e-02 -1.38197029e-02\n",
            "  -2.89080422e-02  4.96430434e-02  2.32407986e-03 -1.33345470e-01\n",
            "   8.21728185e-02 -2.75328998e-02 -3.54886539e-02 -3.05679273e-02\n",
            "  -4.09697630e-02  4.59233671e-02  2.36810464e-02 -1.81057919e-02\n",
            "  -4.63856310e-02 -2.57413499e-02  1.37220323e-01 -2.60194931e-02\n",
            "   5.12605254e-03 -1.03210472e-02  7.48181948e-03 -2.26173713e-03\n",
            "   4.54176255e-02 -3.83389974e-03 -7.03694820e-02  4.30076383e-02\n",
            "   4.37871516e-02  4.15213816e-02  4.87397835e-02  2.85938159e-02\n",
            "  -6.75747544e-03  3.57974879e-02 -3.77113931e-02  1.62075572e-02\n",
            "   2.67590955e-02 -3.95426853e-03 -3.81460339e-02 -4.69296128e-02\n",
            "   4.09718566e-02  5.80453165e-02 -2.86636502e-02  1.29146185e-02\n",
            "   1.96134355e-02  7.08232000e-02 -8.01674724e-02 -8.11381340e-02\n",
            "   8.37649161e-04  6.49866015e-02 -6.79904073e-02  3.91278379e-02\n",
            "   1.06793102e-02  1.27003866e-03  1.25748049e-02  2.27742586e-02\n",
            "  -1.29536157e-02 -9.19403806e-02 -2.52826326e-02  4.89279535e-03\n",
            "  -1.11822654e-02  4.25527617e-02 -4.07838542e-03 -7.70672709e-02\n",
            "  -3.72242853e-02  5.75370789e-02 -3.76949981e-02  8.29622895e-02\n",
            "  -5.35054728e-02 -3.90643589e-02  5.29102385e-02  5.10063209e-02\n",
            "   4.21568304e-02 -8.92611593e-03 -7.58128241e-03 -2.63581350e-02\n",
            "  -2.26192344e-02  5.25270812e-02 -3.16370279e-02  1.76016428e-02\n",
            "  -4.12163604e-03  8.98829196e-03 -5.41681573e-02 -3.51686738e-02\n",
            "   7.49530345e-02 -8.40425938e-02 -6.46067131e-03 -8.43616500e-02\n",
            "   6.84093460e-02  6.74258694e-02  3.54364212e-03  3.04589160e-02\n",
            "  -1.22148823e-02 -8.63147080e-02  8.88535827e-02  7.20860716e-03\n",
            "   3.91792394e-02  1.54026458e-02 -4.05198187e-02  8.64915848e-02\n",
            "  -8.07254750e-04 -7.78760761e-02 -4.54326905e-02  5.28050177e-02\n",
            "  -5.62739978e-03  6.11565122e-03 -6.97697848e-02  7.16370251e-03\n",
            "  -7.23545393e-03 -5.80236875e-03 -6.14263117e-03  4.36933748e-02\n",
            "  -4.09165807e-02  3.38043422e-02  2.02438887e-02 -2.41066236e-02\n",
            "  -8.47658068e-02  5.40625341e-02  1.90485120e-02  7.07049742e-02\n",
            "   1.82436015e-02  5.43259755e-02  3.92058603e-02 -4.70370501e-02\n",
            "   5.34813851e-02  9.19938646e-03 -7.18093589e-02  1.73158273e-02\n",
            "   3.50059681e-02 -3.97511460e-02 -1.19257607e-02 -1.93105657e-02\n",
            "   2.63124499e-02  1.92852877e-02 -1.08727120e-01  2.90959906e-02\n",
            "  -2.17968784e-02 -3.98247913e-02 -5.65343723e-02 -4.98243161e-02\n",
            "   1.03460280e-02  8.27793032e-03 -4.05325554e-02 -3.17442901e-02\n",
            "  -5.80707639e-02 -5.17777912e-02 -2.55079791e-02 -4.36673276e-02\n",
            "  -1.22423964e-02 -7.51144066e-02  1.03437593e-02 -1.06008267e-02\n",
            "   5.06449528e-02  3.02781686e-02  9.49071050e-02  4.61306572e-02\n",
            "  -4.68961298e-02  8.47776700e-03  3.43159437e-02 -6.14112020e-02\n",
            "  -2.21710410e-02 -3.92043851e-02 -2.45831651e-03 -3.62032838e-03\n",
            "   1.44873851e-03  1.46154845e-02  1.24558592e-02 -1.51917227e-02\n",
            "   1.43423183e-02 -2.67317761e-02 -1.51421186e-02  6.38127420e-03\n",
            "   3.43732648e-02 -2.19633356e-02 -3.06076575e-02  1.92781631e-02\n",
            "   6.28831238e-02  2.92293504e-02 -8.18964913e-02 -3.44791114e-02\n",
            "  -3.52811515e-02  3.25790383e-02 -1.07220495e-02 -1.13973673e-02\n",
            "   7.01279491e-02  2.38498934e-02 -7.57561550e-02 -1.00615043e-02\n",
            "  -5.33679686e-02 -3.94886993e-02 -2.33043209e-02 -9.55063552e-02\n",
            "  -3.61333601e-02  5.19587100e-02 -5.01175262e-02 -3.54333147e-02\n",
            "  -8.77424255e-02  2.32290608e-04  5.18830046e-02  7.78203248e-04\n",
            "   2.43817400e-02 -3.17396373e-02  2.01386623e-02  1.01001533e-02]]\n"
          ],
          "name": "stdout"
        }
      ]
    }
  ]
}